<%@ page import="java.util.Date" %>
<%@ page import="com.javaweb.common.StringTool" %><%--
  Function: 
  User: PING
  Date: 2022/9/22

--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  String name = "zhangsan" ;
  Date now = new Date() ;

    /**
     * put date into the JSP object
     */
    // 1. put date into pageContext
/*    pageContext.setAttribute("name", name);
    pageContext.setAttribute("time", now);*/
    // 2. put date into request
    request.setAttribute("name", name);
    request.setAttribute("time", now);
    // 3. put date into session
/*    session.setAttribute("name", name);
    session.setAttribute("time", now);
    out.println("SID: " + session.getId()) ;*/
    // 3. put date into application
    application.setAttribute("name", name);
    application.setAttribute("time", now);

%>


<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<%
    // 跳转： forward or redirect
    // forward in SERVER side.
//    request.getRequestDispatcher("01_scope_show.jsp").forward(request, response);
    // redirect in CLIENT SIDE
/*    response.sendRedirect("01_scope_show.jsp");*/

%>
<%--<jsp:forward page="01_scope_show.jsp"/>--%>

<%--
<div class="show">
    <h3>名字： <%= pageContext.getAttribute("name")%></h3><br>
    <h3>时间： <%=StringTool.formatTime((Date)pageContext.getAttribute("time"))%></h3>

</div>--%>

</body>
</html>
